﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ExcelTest
{
    public class ExportModel
    {
        /// <summary>
        /// 文件名
        /// </summary>
        public string FileName { get; set; }
        /// <summary>
        /// 表格名
        /// </summary>
        public string SheetName { get; set; } = "Sheet1";
        /// <summary>
        /// 导出保存的路径
        /// </summary>
        public string SavePath { get; set; }
        /// <summary>
        /// excel类型
        /// </summary>
        public ExcelSuffix ExcelSuffix { get; set; }
        public string Title { get; set; }

        public string FilePath => $"{SavePath.TrimEnd(new char[] { '/', '\\' })}/" +
                $"{FileName.TrimStart(new char[] { '/', '\\' })}.{ExcelSuffix}";
    }

    [AttributeUsage(AttributeTargets.Property)]
    public class ExcelColumAttribute : Attribute
    {
        public string? Name { get; set; }
        public bool Ignore { get; set; }

        public ExcelColumAttribute()
        {
        }

        public ExcelColumAttribute(string name)
        {
            Name = name;
        }

        public ExcelColumAttribute(bool ignore)
        {
            Ignore = ignore;
        }
    }

    /// <summary>
    /// excel文件拓展名
    /// </summary>
    public enum ExcelSuffix
    {
        /// <summary>
        /// .xlsx
        /// </summary>
        xlsx,
        /// <summary>
        /// .xls
        /// </summary>
        xls
    }
}
